

package io.lkt.modules.sys.controller;

import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.R;
import io.lkt.modules.sys.entity.BTeamInfoEntity;
import io.lkt.modules.sys.service.BTeamInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 团队基础信息
 *
 */
@RestController
@RequestMapping("/sys/bteaminfo")
public class BTeamInfoController {
    @Autowired
    private BTeamInfoService bTeamInfoService;

    /**
     * 团队基础信息列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("sys:bteaminfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bTeamInfoService.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 团队信息
     */
    @RequestMapping("/info/{teamId}")
    @RequiresPermissions("sys:bteaminfo:info")
    public R info(@PathVariable("teamId") Long teamId){
        BTeamInfoEntity bteaminfo = bTeamInfoService.getById(teamId);
        return R.ok().put("bteaminfo", bteaminfo);
    }

    /**
     * 修改团队
     * @param entity 团队实体信息
     * @return
     */
    @RequestMapping("/update")
    public R update(@RequestBody BTeamInfoEntity entity) {
        bTeamInfoService.update(entity);
        return R.ok();
    }

    /**
     * 删除团队
     */
    @RequestMapping("/delete")
    @RequiresPermissions("sys:bteaminfo:delete")
    public R delete(@RequestBody Long[] teamIds){
        bTeamInfoService.deleteBatch(teamIds);
        return R.ok();
    }
}
